package com.example.mygrade.webapi;

import com.example.mygrade.core.RUtil;
import com.example.mygrade.domain.Student;
import com.example.mygrade.service.StudentService;
import com.example.mygrade.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/list")
public class StudentApiController {
    @Autowired
    private StudentService studentService;

    @GetMapping("/studentInfo")
    public R student() throws Exception{
        List<Student> student = studentService.findAll();
        return RUtil.success(student,"成功执行");
    }
}
